package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class LambdaDemo {
    public static void main(String[] args) {
        List<String> list2 = new ArrayList<>();
        list2.add("孙双良");
        list2.add("汪汪汪");
        list2.add("狗叫");
        System.out.println(list2);
        Collections.sort(list2);
        System.out.println("这是排序后的数据"+list2);
        Collections.reverse(list2);
        System.out.println("这是反转后的数据"+list2);
        Collections.sort(list2,(o1,o2)->o2.length()-o1.length());
        System.out.println("这是按照长度排序后的数据"+list2);

    }
}
